diff options
| author | Adam Soltys <[email protected]> | 2023-03-28 22:45:44 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-03-28 22:45:44 -0700 |
| commit | ca205d1963ef1563a5202860926eca061cb787c5 (patch) | |
| tree | efdabbb9d3ef917eae47f7f81aadad00c24ad11d /src/routes/(app)/[username]/invoice | |
| parent | c3a5af59a05414e2a8ece63a5b6f9997d7bf3d3d (diff) | |
| download | coinos-ui-ca205d1963ef1563a5202860926eca061cb787c5.tar.gz coinos-ui-ca205d1963ef1563a5202860926eca061cb787c5.zip | |
show user's currency
Diffstat (limited to 'src/routes/(app)/[username]/invoice')
| -rw-r--r-- | src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte index 9d9021a6..c0b504f8 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte @@ -56,7 +56,7 @@ export let data; $: refresh(data); - let { invoice, id, user } = data; + let { invoice, id, user, rates } = data; let { amount, hash, @@ -82,17 +82,19 @@ amount, hash, type, - rate, received, prompt, text, tip, - user: { username, currency } + user: { username } } = invoice); tipPercent = (tip / amount) * 100; }; + $: currency = user?.currency || invoice.currency; + $: rate = invoice.rate * (rates[currency] / rates[invoice.currency]); + $: tip = Math.round((amount / 100) * tipPercent); $: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2)); |
